<?php

include("mathoperations.php");

if(isset($_GET['n']) == NULL) $ni = 0; else $ni = $_GET['n'];
if(isset($_GET['serie']) == NULL) $seriei = 0; else $seriei = $_GET['serie'];

$serie = "".$seriei."";

if($ni<100000){
	for($n=$ni; $n<1000+$ni; $n++){
		$q = $n%2 == 0 ? "1" : "-1";
		$div = numberdiv($q, "".(2*$n+1)."");
		$serie = numbersum($serie, $div);
		//echo "div = $q / ".(2*$n+1)." = $div";
		//echo "serie = $serie<br>";
		//echo "<hr>";
	}
	//header('location=piteste.php?n='.$n.'&serie='.$serie);

	echo '<META http-equiv="refresh" content="0;URL=piteste.php?n='.$n.'&serie='.$serie.'">';
}else{
	echo numbermult("4", $serie);
}


//echo $serie;
//echo $n;

//echo numbersum("1", "-0.3333333333333333333");

?>